<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        div {
            text-align: center;
        }

        table {
            width: 100vw;
            margin: 0 auto;

        }
    </style>
</head>

<body>
    <div id="app">
        <h3>欢迎光临_vue开发的收银系统_水果店</h3>
        <table border="1">
            <tr>
                <th>苹果10￥/斤，折扣/《8折》</th>
            </tr>
            <tr>
                <td>
                    <span>请输入你要购买的斤数</span>
                    <input type="number" v-model.number="num"></input>
                </td>
            </tr>
            <tr>
                <td>
                    <button @click="getTotal">结账买单~</button>
                </td>
            </tr>
            <tr>
                <td>
                    <p>结账单：总价:{{totalPrice}}元 折后价:{{totalPrice * 0.8}}元 省了:{{totalPrice * 0.2}}元</p>
                </td>
            </tr>
        </table>
    </div>
    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                num: 0,
                totalPrice:0
            },
            methods:{
                getTotal(){
                    this.totalPrice = this.num * 10
                }
            }
        })
    </script>
</body>

</html>